<!doctype html>
<html lang="zh-cn">
<head>
{% include "tdm_include_head_template.html" %}

<script type="text/javascript">
$(function() {
  sidebar_nav_clone();

  var item_div_id = [];
  {% for item_name in net_dev_items %}
  item_div_id.push('{{item_name}}');
  {% endfor %}

  $.each(item_div_id, function(i, n) {
    $.getJSON(id_to_url(n, '/json/network_item_warn_alert/'), function (data) {
      var item_warn_alert = '';
      if (data.alert_nr) {
        item_warn_alert+='<div class="pull-right"><span class="badge badge-danger">'+data.alert_nr+'</span></div>';
      }
      if (data.warn_nr) {
        item_warn_alert+='<div class="pull-right"><span class="badge badge-warning">'+data.warn_nr+'</span></div>';
      }
      $(flot_id_translate(n, '')).html('<a href="'+id_to_url(n, '/tdm/network_item/')+'">'+item_name_show(n)+item_warn_alert+'</a>');
    });

    $.getJSON(id_to_url(n, '/json/network_item_data/'), { req_time: "0" }, function (data) {
        column_show(flot_id_translate(n, '_flot'), data);
    });

    /*
    $.getJSON(id_to_url(n, '/json/network_item_data/'), { req_time: "0" }, function (json_data) {
      // Create the chart
      $(flot_id_translate(n, '_flot')).highcharts('StockChart', {
          rangeSelector: {selected: 1, inputEnabled: $('#container').width() > 4800 },
          title: {text: n },
          global: {useUTC: false },
          legend: {layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0 },
          credits:{
              //enabled:true,
              text: '好未来',
              href: 'http://www.100tal.com',
              position: {align: 'right', verticalAlign: 'bottom', y: -80 },
              style: {cursor: 'pointer', fontSize: '10px'},
          },
          rangeSelector: {
              buttons: [
                { type: 'hour', count: 1, text: '1h' },
                { type: 'day', count: 1, text: '1D' },
                { type: 'week', count: 1, text: '1W' },
                { type: 'year', count: 1, text: '1Y' },
                { type: 'all', count: 1, text: 'All' }],
              selected: 0,
              inputEnabled: false
          },
          yAxis: { min: -10, max: 10 },
          series: [{
            type: 'column',
            data: json_data[0].data,
            name: json_data[0].name,
          }],
      });
    });
    */

  });
  Highcharts.setOptions({global:{useUTC : false}});

});
</script>

</head>

<body class=" theme-blue">
{% include "tdm_include_navbar_template.html" %}

<div class="sidebar-nav">
  <ul id="city_jxd">
  {% for city in jxd_list_all %}
  <li>
    <a href="#" data-target=".{{city.name}}-menu" class="nav-header collapsed" data-toggle="collapse" aria-expanded="false">
      <i class="fa fa-fw fa-bars"></i>
      {{city.name}}
      {% if city.net_warn_nr %}
      <span class="badge badge-warning">{{city.net_warn_nr}}</span>
      {% endif %}
      {% if city.net_alert_nr %}
      <span class="badge badge-danger">{{city.net_alert_nr}}</span>
      {% endif %}
      <i class="fa fa-collapse"></i>
    </a>
  </li>
  <li>
    <ul class="{{city.name}}-menu nav nav-list collapse {% ifequal view_city city.name %}in{% endifequal %}">
      {% for jxd in city.jxd_list %}
      <li>
        <a href="/tdm/network/{{city.name}}/{{jxd.name}}">
          <span class="fa fa-caret-right"></span>
          {{jxd.name}}
          {% if jxd.warning_nr %}
          <div class="pull-right">
            <span class="badge badge-warning">{{jxd.warning_nr}}</span>
          </div>
          {% endif %}
          {% if jxd.alert_nr %}
          <div class="pull-right">
            <span class="badge badge-danger">{{jxd.alert_nr}}</span>
          </div>
          {% endif %}
        </a>
      </li>
      {% endfor %}
    </ul>
  </li>
  {% endfor %}
  </ul>
</div>

<div class="content">
  <div class="header">
    <a class="btn btn-primary" rol="button" href="/tdm/network/{{city}}/{{jxd}}/">
      <span class="glyphicon glyphicon-circle-arrow-left"></span>
      {{city}} - {{jxd}}
    </a>
  </div>
  {% for netdev_item in net_dev_items %}
  <div class="item_detail_container">
    <div class="panel panel-default">
      <div id='{{netdev_item}}' class="panel-heading">{{netdev_item}}</div>
      <div class="panel-body">
        <div id="content">
          <div id="{{netdev_item}}_flot" style="height: 200px; min-width: 300px"></div>
        </div>
      </div>
      <div class="panel-footer">
        <!--对于数据的配置信息，在面板尾部。-->
        <p>&nbsp;</p>
      </div>
    </div>
  </div>
  {% endfor %}
  {% include "tdm_include_footer_template.html" %}
</div>

</body>
</html>